#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class Stack
{
public:
    bool push(const string &s)
    { 
        if (full())
            return false;
        _stack.push_back(s);
        return true;
    }

    bool pop(string &s)
    {
        if (empty())
            return false;
        s = _stack.back();
        _stack.pop_back();
        return true;
    }

    bool peek(string &s)
    {
        if (empty())
            return false;
        s = _stack.back();
        return true;
    }


    bool full()
    {
        return _stack.size() == _stack.max_size();
    }

    bool empty()
    {
        return _stack.empty();
    }

    int size() const
    { 
        return _stack.size(); 
    }

    bool find(const string &s)
    {
        return std::find(_stack.begin(), _stack.end(), s) != _stack.end(); 
    }

    int count(const string &s)
    {
        return std::count(_stack.begin(), _stack.end(), s); 
    }
    
private:
    vector<string> _stack;
};

ostream& operator<<(ostream &os, const Stack &stack)
{
    os << "size is " << stack.size();
    return os;
}

istream& operator>>(istream &is, Stack &stack)
{
    string s;
    is >> s;
    stack.push(s);
    return is;
}

int main()
{
    Stack s;
    string str = "123";

    cout << s.empty() << endl;
    cout << s.full() << endl;
    cout << s.size() << endl;

    s.push(str);
    cout << s.empty() << endl;
    cout << s.full() << endl;
    cout << s.size() << endl;

    s.push("456");
    cout << s.empty() << endl;
    cout << s.full() << endl;
    cout << s.size() << endl;
    
    s.peek(str);
    cout << str << endl;

    s.pop(str);
    cout << str << endl;

    cout << s.empty() << endl;
    cout << s.full() << endl;
    cout << s.size() << endl;

    cout << s.find("123") << endl;
    cout << s.find("456") << endl;
    cout << s.count("123") << endl;
    cout << s.count("456") << endl;

    cout << s << endl;
    cin >> s;
    cout << s << endl;

    return 0;
}
